package com.test.controller.api;

import com.test.service.AuthService;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;

@Controller
@RequestMapping("/api/auth")
public class AuthController {
    @Resource
    AuthService authService;
    @RequestMapping(value = "/register",method = RequestMethod.POST)
    public String register(@RequestParam("username")String username, @RequestParam("sex")String sex, @RequestParam("grade")String grade, @RequestParam("password")String password, Model model){
        authService.register(username,sex,grade,password);
        return "redirect:/login";
    }
}
